<?php

//本地路径
$local = '/home/www/jarvan/';

//仓库地址
$remote = 'https://gitee.com/bestjarvan/jarvan.git';
 
//密码
$password = 'jyh123';

//获取请求参数
$request = file_get_contents('php://input');
if (empty($request)) {
  return 'request is empty';
}

//验证密码是否正确
$data = json_decode($request, true);
if ($data['password'] != $password) {
  return 'password is error';
}
 
echo shell_exec("cd {$local} && git pull {$remote} 2>&1");
return 'done ' . date('Y-m-d H:i:s', time());